package com.miaosha.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.miaosha.entity.Order;
import com.miaosha.entity.dto.SellerListResDto;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;
import java.util.Map;


@Mapper
public interface OrderMapper extends BaseMapper<Order> {

    /**
     * 根据条件获取订单
     *
     * @param map
     * @return
     */
    List<Order> list(Map<String, Object> map);

    /**
     * 根据用户id和秒杀商品id获取订单(用于判断用户是否重复秒杀)
     *
     * @param map
     * @return
     */
    Order findByUserIdAndMiaoShaGoodsId(Map<String, Object> map);

    /**
     * 添加订单
     *
     * @param order
     * @return
     */
    int add(Order order);

    List<SellerListResDto> sellerList(Long userId);
}